using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Generic;
using System.Text;

namespace Alogient.Cameleon.Forms.Sdk.Items
{
    public class DateRange : FormElement
    {
        public DateTime? MinValue1 {
            get
            {
                if (_long1 != null)
                    return new DateTime(_long1.Value);
                else
                    return null;
            }
        }
        public DateTime? MaxValue1 {
            get
            {
                if (_long2 != null)
                    return new DateTime(_long2.Value);
                else
                    return null;
            }
        }
        public DateTime? DefaultValue1 {
            get
            {
                long along;
                if (_text1 != null && long.TryParse(_text1, out along))
                    return new DateTime(along);
                else
                    return null;
            }
        }
        public bool UseNow1 { 
            get {
                if (_boolean1 == null)
                    return false;
                return _boolean1.Value; } 
        }

        public DateTime? MinValue2 {
            get
            {
                if (_long3 != null)
                    return new DateTime(_long3.Value);
                else
                    return null;
            }
        }
        public DateTime? MaxValue2 {
            get
            {
                if (_long4 != null)
                    return new DateTime(_long4.Value);
                else
                    return null;
            }
        }
        public DateTime? DefaultValue2 {
            get
            {
                long along;
                if (_text2 != null && long.TryParse(_text2, out along))
                    return new DateTime(along);
                else
                    return null;
            }
        }
        public bool UseNow2 { 
            get {
                if (_boolean2 == null)
                    return false;
                return _boolean2.Value; } 
        }

        public DateRange(int id, string cultureCode) : base(id, cultureCode) { }

    }
}
